<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>createRef</title>
</head>
<body>
<div id="app"></div>
<script src="../lib/babel.min.js"></script>
<script src="../lib/react.development.js"></script>
<script src="../lib/react-dom.development.js"></script>
<script src="../lib/prop-types.js"></script>
<script type="text/babel">
  class Demo extends React.Component{
    // createRef可以返回一个容器，该容器可以保存ref所表示的结点(只能存一个)
    InputRef = React.createRef()
    showInfo = () => {
      console.log(this);
      alert(this.InputRef.current.value);
    }
    render(){
      return (
        <div><input onBlur={this.showInfo} ref={this.InputRef} type="text"/></div>
      )
    }
  }
  ReactDOM.render(<Demo/>, document.querySelector('#app'));
</script>
</body>
</html>
